﻿using System;
using System.Collections.Generic;
using System.Linq;
using CodeStash.Common.DataAccess.EntityFramework;

namespace CodeStash.Models.Snippet
{

    public class ReadOnlyDisplaySnippetsViewModel
    {
        public static int MAX_SNIPPETS_TO_DISPLAY = 100;

        public ReadOnlyDisplaySnippetsViewModel(
            List<CodeSnippet> codeSnippets, 
            bool isTruncated,
            String highlightingCSS)
        {
            this.CodeSnippets = codeSnippets;
            this.IsTruncated = isTruncated;
            this.HighlightingCSS = highlightingCSS;
            IsGrouped = this.CodeSnippets.Any(x => x.GroupId.HasValue);
        }


        public List<CodeSnippet> CodeSnippets { get; private set; }
        public bool IsTruncated { get; private set; }
        public bool IsGrouped { get; private set; }
        public string HighlightingCSS  { get; private set; }

    }
}